//
//  ZYZTitleView.swift
//  MyWeiBo
//
//  Created by 牛牛很牛 on 15/12/23.
//  Copyright © 2015年 曾勇召. All rights reserved.
//

import UIKit

class ZYZTitleView: UIButton {
    init(imameName:String, title:String) {
    super.init(frame: CGRectZero)
        setImage(UIImage(named: imameName), forState: UIControlState.Normal)
        setTitle(title, forState: UIControlState.Normal)
        setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        sizeToFit()
        
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    //修改图片和文字布局
    override func layoutSubviews() {
        super.layoutSubviews()
        self.titleLabel?.frame.origin.x = 0
        self.imageView?.frame.origin.x = (self.titleLabel?.bounds.width)!+3
    }

}
